﻿using System.ComponentModel.Design;
using System.Text;
using Calculate;

const string TEST_INPUT = "(2+2)*2";
string input = TEST_INPUT;
functions func = new();

string extractFile()
{
    FileStream file = new FileStream("C:\\Users\\antrelax\\source\\repos\\Calculate\\Calculate\\test.txt", FileMode.Open, FileAccess.Read);
    byte[] buffer = new byte[file.Length];
    file.Read(buffer, 0, buffer.Length);

    file.Close();

    string text = Encoding.UTF8.GetString(buffer);
    return text;
}

void test()
{
    var text = extractFile();
    var tests = text.Split('\n');

    foreach (var test in tests )
    {
        string[] formInput = func.convertToArray(test);
        Console.WriteLine(func.CalculateExpressionWithBKT(formInput));
    }
}

//string[] formInput = func.convertToArray(input);
//Console.WriteLine(func.CalculateExpressionWithBKT(formInput));

test();